﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace MediaPlayer.Model
{
	[Serializable]
	class PlayList
	{
		[XmlIgnore]
		public string		Name;

		public List<Song>	SongList;

		public void AddSong(Song song)
		{
			this.SongList.Add(song);
		}

		public void RemoveSong(Song song)
		{
			if (this.DoesSoundIsInList(song) == true)
				this.SongList.Remove(song);
		}

		private bool DoesSoundIsInList(Song song)
		{
			return this.SongList.Exists(new Predicate<Song>( (Song) =>
			{
				if (song.Name == Song.Name)
					return true;
				return false;
			}));
		}
	}
}
